how to find maximum level of profit